Example 5-1 : Checking for Extensions
main(int argc, char* argv[]) { ... if (!QueryExtension("GL_EXT_texture_object")) { fprintf(stderr, "texture_object extension not supported.\n"); exit(1); } ... } static GLboolean QueryExtension(char *extName) { /* ** Search for extName in the extensions string. Use of strstr() ** is not sufficient because extension names can be prefixes of ** other extension names. Could use strtok() but the constant ** string returned by glGetString might be in read-only memory. */ char *p; char *end; int extNameLen; extNameLen = strlen(extName); p = (char *)glGetString(GL_EXTENSIONS); if (NULL == p) { return GL_FALSE; } end = p + strlen(p); while (p < end) { int n = strcspn(p, " "); if ((extNameLen == n) && (strncmp(extName, p, n) == 0)) { return GL_TRUE; } p += (n + 1); } return GL_FALSE; }As an alternative to checking for each extension explicitly, you can make the following calls to determine the system and IRIX release on which your program is running:
glGetString(GL_RENDERER) ... glGetString(GL_VERSION)Given a list of extensions supported on that system for that release, you can determine whether the particular extension you need is available. For this to work on all systems, a table of different systems and the extensions supported has to be available.
When an extension is incomplete, it is not advertised in the extensions string. Some of the RealityEngine extensions supported in IRIX 5.3 (for example, the subtexture, sharpen texture, convolution, and histogram extensions) fall in that category.